package zlx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import zlx.pojo.Book;
import zlx.pojo.Page;
import zlx.service.IndexService;

import javax.annotation.Resource;

@Controller
public class IndexController {
    @Resource(name = "indexService")
    private IndexService indexService;
    //书城的首页
    @RequestMapping(name = "/Index",method = RequestMethod.GET)
    public String index(Model model,Integer pageNo){
        Page<Book> page = indexService.selectAllBook(pageNo);
        page.setUrl("/Index");
        System.out.println(page);
        model.addAttribute("page",page);
        return "/pages/client/index.jsp";
    }
}
